package com.cky.software.wubaihe;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TestComplexMain {

    public static void main(String[] args) {
        sum();
        map();
        sum();
        list();
        forTest();
    }

    public static void map() {
//        1.声明HashMap
        Map<String,Object> map=new HashMap<>();
//        2.在HashMap 里取数据
        map.put("A","苹果");
        map.put("B","香蕉");
//        3.从HashMap中把数据打印出来
        System.out.println(map);
    }

    public static void list() {
//        1.声明ArrayList
        List<String> list=new ArrayList<>();
//        2.在ArrayList里取数据
        list.add("A");
        list.add("B");
//        3.从ArrayList中把数据打印出来
        System.out.println(list.get(0));
        System.out.println(list.get(1));
        System.out.println(list);
    }

    public static void sum() {
        System.out.println("-------------------");
    }

    public static void forTest() {
        for (int i=1;i<=6;i++){
            if(i%2==0){
                System.out.println("当前为偶数:"+i);
            }else if(i%2 != 0){
                System.out.println("当前数为奇数："+i);
            }
        }
    }

}
